import React from 'react';
import ReactDOM from 'react-dom';
import { createHashHistory } from 'History';
import { Router, Route, useRouterHistory, } from 'react-router';

import { RouterStore, syncHistoryWithStore } from 'mobx-react-router';

import { Provider } from 'mobx-react';

const routingStore = new RouterStore();
const browserHistory = useRouterHistory(createHashHistory)({
    queryKey: '_key',
    basename: '/'
});

import Contract from "./index.js";
// import weaCube from 'weaCube';
// const CubeStore = weaCube.store;
// const CubeRoute = weaCube.Route;

const ContractStore = Contract.store;
const ContractRoute = Contract.Route;

const history = syncHistoryWithStore(browserHistory, routingStore);
window.weaHistory = history;

let store = {
    routing: routingStore,
    ...ContractStore,
    // ...CubeStore
}

const Home = props => props.children;

class Root extends React.Component {
   
    render() {
        return (
            <Provider {...store}>
                <Router history={history}>
                    <Route name="main" breadcrumbName="入口" path="main" component={Home}>
                        {ContractRoute}
                        {/* {CubeRoute} */}
                    </Route>
                </Router>
            </Provider>
        )
    }
}
ReactDOM.render(<Root />, document.getElementById('container'));